<template>
  <div>
    <Table
      :columns="columns"
      :data="datas"
      ref="table"
      :loading="loading"
      highlight-row
      no-data-text="暂无数据"
      no-filtered-data-text="暂无筛选结果"
      @on-select="handleSelectRow"
      @on-select-cancel="handleCancelRow"
      @on-select-all="handleSelectAll"
      @on-select-all-cancel="handleSelectAll"
	  style="margin-right: 100px;padding: 0px;"
    >
      <template slot-scope="{ row, index }" slot="id">
        {{index+1}}
      </template>
      <template slot-scope="{ row, index }" slot="cover">
        <img :src="row.cover" style="width:80px;height:80px;">
      </template>
      <template slot-scope="{ row, index }" slot="action">
    	<a @click="selectItem(row)">选择</a>
      </template>
    </Table>
  </div>
</template>

<script>
import icon from '@/utils/icon';
import { getCookies } from '@/libs/util';
export default {
  name: 'menusFrom',
  props: {
    formValidate: {
      type: Object,
      default: null,
    },
    titleFrom: {
      type: String,
      default: '',
    },
	datas:[],
	receiveData:undefined
  },
  components: {  },
  data() {
    return {
      
      grid: {
        xl: 12,
        lg: 12,
        md: 12,
        sm: 24,
        xs: 24,
      },
      gridPic: {
        xl: 6,
        lg: 8,
        md: 12,
        sm: 12,
        xs: 12,
      },
      gridBtn: {
        xl: 4,
        lg: 8,
        md: 8,
        sm: 8,
        xs: 8,
      },
	  loading: false,
	  tableData: [],
	  columns: [
	  		{
	       title: '序号',
	       align: 'center',
	       slot: 'id',
	       width: 70,
	     },
	  	 {
	       title: '型号',
	       align: 'center',
	       key: 'model',
	       minWidth: 80,
	     },
	  	 {
	       title: '颜色',
	       align: 'center',
	       key: 'color',
	       minWidth: 80,
	     },
	  	 {
	       title: '厂商',
	       align: 'center',
	       key: 'company_id_name',
	       minWidth: 100,
	     },
		 {
	       title: '规格',
	       align: 'center',
	       key: 'specs',
	       minWidth: 100,
	     },
		 {
	       title: '单位',
	       align: 'center',
	       key: 'unit',
	       minWidth: 50,
	     },
		 {
	       title: '单价',
	       align: 'center',
	       key: 'price',
	       minWidth: 70,
	     },
		 {
	       title: '数量',
	       align: 'center',
	       key: 'current_num',
	       minWidth: 70,
	     },
	     {
	       title: '操作',
	       slot: 'action',
	       fixed: 'right',
	       minWidth: 100,
	       align: 'center',
	     },
	   ],
    };
  },
  watch: {
    'formValidate.header': function (n) {
      this.formValidate.is_header = n ? 1 : 0;
    },
    'formValidate.auth_type': function (n) {
      if (n === undefined) {
        n = 1;
      }
      this.authType = n === 1;
    },
    'formValidate.data': function (n) {},
  },
  computed: {
	  
  },
  methods: {
	// 上传头部token
	getToken() {
	  this.header['Authori-zation'] = 'Bearer ' + getCookies('token');
	  console.info(this.header);
	},
	selectItem(row){
		this.receiveData(row)
	}
  },
  created() {
    this.getToken();
  },
};
</script>

<style scoped>

</style>
